<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>ForEach : Next</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="5">ForEach : Next</font></b></p>

<br><b>语法</b><blockquote><pre><font face="Courier New, Courier, mono"size="2"><b><font color="#006666">ForEach</font></b> <font color="#006666">List</font>() <b>Or</b> <font color="#006666">Map</font>()
  ...
<b><font color="#006666">Next</font></b> [List() <b>Or</b> Map()]
</font></pre></blockquote>
<b>概要</b><br><blockquote>


<b><font color="#006666">ForEach</font></b> loops through all elements in the specified list or map starting from the first 
element up to the last. If the list or the map is empty, <b><font color="#006666">ForEach</font></b> : <b><font color="#006666">Next</font></b> exits immediately. 
To view all commands used to manage lists, please click <a href="../list/index.html">here</a>. 
To view all commands used to manage maps, please click <a href="../map/index.html">here</a>. <br>
<br>
When used with list, it's possible to <a href="../list/deleteelement.html">delete</a> or <a href="../list/addelement.html">add</a> elements 
during the loop. As well it's allowed to change the current element with <a href="../list/changecurrentelement.html">ChangeCurrentElement()</a>. 
After one of the mentioned changes the next loop continues with the element following the current element. 
<br>
<br>
With the <a href="../reference/break_continue.html">Break</a> command its possible to exit the <b><font color="#006666">ForEach</font></b> : <b><font color="#006666">Next</font></b> loop 
at any moment, with the <a href="../reference/break_continue.html">Continue</a> command the end of the current iteration can be skipped. 

 

</blockquote><p><b>Example:</b> list</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">NewList</font></b> <font color="#006666">Number</font>()
  
<font color="#006666">  AddElement</font>(<font color="#006666">Number</font>())
<font color="#006666">  Number</font>() = 10
    
<font color="#006666">  AddElement</font>(<font color="#006666">Number</font>())
<font color="#006666">  Number</font>() = 20
    
<font color="#006666">  AddElement</font>(<font color="#006666">Number</font>())
<font color="#006666">  Number</font>() = 30
    
  <b><font color="#006666">ForEach</font></b> <font color="#006666">Number</font>()
    <b><font color="#006666">Debug</font></b> <font color="#006666">Number</font>() <font color="#006666">; Will output 10, 20 and 30</font>
  <b><font color="#006666">Next</font></b>
</font></pre>

</blockquote><p><b>Example:</b> Map</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">NewMap</font></b> <font color="#006666">Country</font>.s()

<font color="#006666">  Country</font>("US") = "United States"
<font color="#006666">  Country</font>("FR") = "France"
<font color="#006666">  Country</font>("GE") = "Germany"

  <b><font color="#006666">ForEach</font></b> <font color="#006666">Country</font>()
    <b><font color="#006666">Debug</font></b> <font color="#006666">Country</font>()
  <b><font color="#006666">Next</font></b>
</font></pre>
</body></html>